﻿Imports RunEnv

Public Class dlgGetValue
    Private value As Object
    Private mobjField As CField

    Public Function ShowOpen(ByVal field As CField) As Object
        Dim sql As String
        mobjField = field
        Me.Text = field.FieldTitle & "选择窗"
        sql = " Select " & mobjField.SourceFieldKey & " , " & mobjField.SourceFieldValue &
                " From " & mobjField.SourceTable
        QueryGrid1.Cnn = gcnnDBMain.sqlConnection
        QueryGrid1.RecordSQL = sql
        QueryGrid1.Init()
        QueryGrid1.ColumnFooters = False

        Me.ShowDialog()

        Return value
    End Function

    Private Sub QueryGrid1_RowDoubleClick(rowIndex As Integer) Handles QueryGrid1.RowDoubleClick
        value = QueryGrid1.Rows(rowIndex).Cells(mobjField.SourceFieldValue).Value
        Me.Close()
    End Sub
End Class